package eleanor.ltd.isne.entities.user.group;

import java.io.Serializable;

import javax.persistence.Embeddable;
import javax.persistence.ManyToOne;

import eleanor.ltd.isne.entities.roles.group.RolesGroup;
import eleanor.ltd.isne.entities.roles.group.RolesGroupPK;
import eleanor.ltd.isne.entities.user.User;

@Embeddable
public class UserGroupPK implements Serializable{

	@ManyToOne
	private RolesGroup rolesGroup;
	@ManyToOne
	private User user;
	
	public RolesGroup getRolesGroup() {
		return rolesGroup;
	}
	public void setRolesGroup(RolesGroup rolesGroup) {
		this.rolesGroup = rolesGroup;
	}
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;

		UserGroupPK that = (UserGroupPK) o;

		if (rolesGroup != null ? !rolesGroup.equals(that.rolesGroup) : that.rolesGroup != null)
			return false;
		if (user != null ? !user.equals(that.user) : that.user != null)
			return false;

		return true;
	}
	
	
}
